﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lidgren.Network;

namespace Orion.Lib
{
    public enum NetworkMode
    {
        Client,
        Server,
        Peer
    }

    public class NetworkManager
    {
        static NetworkManager instance = new NetworkManager();
        public static NetworkManager Instance
        { get { return instance; } }


        public NetServer server;
        public void StartServer()
        {
            // create a configuration
            NetPeerConfiguration config = new NetPeerConfiguration("Orion"); // needs to be same on client and server!
            config.MaximumConnections = 32;
            config.Port = 12345;

            server = new NetServer(config);
            server.Start();
        }

        public NetClient client;
        public void StartClient()
        {
            NetPeerConfiguration config = new NetPeerConfiguration("Orion"); // needs to be same on client and server!
            client = new NetClient(config);
            client.Start();
            client.Connect("127.0.0.1", 12345);
        }
    }
}
